using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The PublicHolidayCodeTableManager class is responsible for managing BO.PublicHolidayCodeTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class PublicHolidayCodeTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all PublicHolidayCodeTable objects in the database.
/// </summary>
/// <returns>A list with all PublicHolidayCodeTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static PublicHolidayCodeTableList GetList(){
return PublicHolidayCodeTableDB.GetList();
}

/// <summary>
/// Gets a single PublicHolidayCodeTable from the database without its data.
/// </summary>
/// <param name="publicHolidayCode">The PublicHolidayCode of the PublicHolidayCodeTable in the database.</param>
/// <returns>A PublicHolidayCodeTable object when the PublicHolidayCode exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static PublicHolidayCodeTable GetItem(int publicHolidayCode){
return GetItem(publicHolidayCode, false);
}

/// <summary>
/// Gets a single PublicHolidayCodeTable from the database.
/// </summary>
/// <param name="publicHolidayCode">The PublicHolidayCode of the PublicHolidayCodeTable in the database.</param>
/// <param name="getPublicHolidayCodeTableRecords">Determines whether to load all associated PublicHolidayCodeTable records as well.</param>
/// <returns>
/// A PublicHolidayCodeTable object when the PublicHolidayCode exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static PublicHolidayCodeTable GetItem(int publicHolidayCode, bool getPublicHolidayCodeTableRecords){
PublicHolidayCodeTable myPublicHolidayCodeTable = PublicHolidayCodeTableDB.GetItem(publicHolidayCode);
return myPublicHolidayCodeTable;
}

/// <summary>
/// Saves a PublicHolidayCodeTable in the database.
/// </summary>
/// <param name="myPublicHolidayCodeTable">The PublicHolidayCodeTable instance to save.</param>
/// <returns>The new PublicHolidayCode if the PublicHolidayCodeTable is new in the database or the existing PublicHolidayCode when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(PublicHolidayCodeTable myPublicHolidayCodeTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int publicHolidayCodeTablePublicHolidayCode = PublicHolidayCodeTableDB.Save(myPublicHolidayCodeTable);

//  Assign the PublicHolidayCodeTable its new (or existing PublicHolidayCode).
myPublicHolidayCodeTable.PublicHolidayCode = publicHolidayCodeTablePublicHolidayCode;

myTransactionScope.Complete();

return publicHolidayCodeTablePublicHolidayCode;
}
}

/// <summary>
/// Deletes a PublicHolidayCodeTable from the database.
/// </summary>
/// <param name="myPublicHolidayCodeTable">The PublicHolidayCodeTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(PublicHolidayCodeTable myPublicHolidayCodeTable){
return PublicHolidayCodeTableDB.Delete(myPublicHolidayCodeTable.PublicHolidayCode);
}

#endregion

}

}
